package com.ktgj.flight.common.spring;

import com.ktgj.flight.domain.InterfaceEntity.MoCreateOrderRequest;
import com.ktgj.flight.domain.InterfaceEntity.MoFlightSearchRequest;
import com.ktgj.flight.domain.InterfaceEntity.MoFlightSearchResponse;
import com.ktgj.flight.domain.InterfaceEntity.MoPassenger;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class TestSpring {
    public static void main(String[] args) {
        _Spring spring = new _Spring();
////        request.TripType = 2;
////        request.GoSearchWhere.DstAirport = "PVG"; //去程到达城市
////        request.GoSearchWhere.OrgAirport = "CKG"; //去程出发城市
////        request.GoSearchWhere.DepDate = "2022--06"; //去程出发时间
////        request.BackSearchWhere.DstAirport = "CKG"; //回程到达城市
////        request.BackSearchWhere.OrgAirport = "PVG"; //回程出发城市
////        request.BackSearchWhere.DepDate = "2021-11-09"; //回程出发时间
        /*MoFlightSearchRequest request = new MoFlightSearchRequest();
        request.TripType = 2;
        request.GoSearchWhere.DstAirport = "SJW"; //去程到达城市
        request.GoSearchWhere.OrgAirport = "CAN"; //去程出发城市
        request.GoSearchWhere.DepDate = "2022-05-19";//去程出发日期

        request.BackSearchWhere.DstAirport = "CAN";
        request.BackSearchWhere.OrgAirport = "SJW";
        request.BackSearchWhere.DepDate = "2022-05-25";

        MoFlightSearchResponse response = spring._FlightSearch(request);
        System.out.println(response);*/

        //预下单
        MoCreateOrderRequest request = new MoCreateOrderRequest();
        MoPassenger moPassenger = new MoPassenger();
        SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
        request.OfferRefID = "N_0/1795823_Y1_1100.0_C";
        moPassenger.age = 33;
        moPassenger.IDNO = "88888888";
        moPassenger.IDType = 4;
        String time = "1988-08-08";
        String time1 = "2030-05-11";
        try {
            moPassenger.Birthday = ft.parse(time);
            moPassenger.IDValidDate = ft.parse(time1);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        moPassenger.PassengerName = "测试吕英彪";
        moPassenger.PassengerType = 1;
        request.ListMoPassenger.add(moPassenger);
        spring._OrderCreateNormal(request);

        //订单查询
        /*MoQueryOrderRequest request = new MoQueryOrderRequest();
        request.OrderID = "FRYEAAHZHS";
        spring._QueryOrderInfo(request);*/

        //取消预订
        /*MoCancelOrderRequest request = new MoCancelOrderRequest();
        MoOrderItem moOrderItem = new MoOrderItem();
        moOrderItem.OrderID = "FRYEAAHZWJ";
        request.ListOrderItem.add(moOrderItem);
        spring._CancelOrder(request);*/

        //初始化订单信息
        /*MoOrderPayRequest request = new MoOrderPayRequest();
        request.OrderID = "FRYEAAHZVW";
        request.PayAmount = BigDecimal.valueOf(1111.0);
        spring._OrderPay(request);*/

        //退票-计算退票费用
        /*MoOrderRefundCaltRequest request = new MoOrderRefundCaltRequest();
        request.OutOrderID = "1401913342";
        spring._OrderRefundCalt(request);*/

        //退票-提交退票申请
        /*MoOrderRefundRequest request = new MoOrderRefundRequest();
        request.OrderID = "1401913342";
        spring._OrderRefund(request);*/

        //变更-查询可变更航班
        /*MoRescheduleSearchRequest request = new MoRescheduleSearchRequest();
        SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
        String time = "2021-11-01";
        request.OrderID = "FRYEAAHZVW";
        request.DepartDate = ft.parse(time);
        request.orderIteamId = "1401913929";
        spring._orderReshopForChange(request);*/

        //变更-计算航班变更申请
        /*MoRescheduleSearchRequest request = new MoRescheduleSearchRequest();
        request.PaxSegmentID = "SEG_1795680";
        request.orderIteamId = "1401913929";
        spring._orderReshopGetPrice(request);*/
    }
}
